<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var a = [35,34,12,5,63,14]
        for (var i =0; i < a.length - 1 ;i++){
            var minIndex = i;
            for(var j = i + 1;j <= a.length - 1;j ++){
                if(a[minIndex] > a[j]){
                    minIndex= j;
                }
                
            }
                var temp = a[i];
                a[i] = a[minIndex];
                a[minIndex] = temp;
        }
        console.log(a);
    </script>
</head>
<body>
    
</body>
</html>